﻿<#include "include/_meta.html">
<title>车辆列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 车辆管理 <span class="c-gray en">&gt;</span> 租用历史 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c">
		车牌号码：<input type="text" class="input-text" style="width:250px" placeholder="输入车牌号码" id="carid" name="carid">
		开始时间：
		<input type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}'})" id="datemin" class="input-text Wdate" style="width:120px;">
		结束时间：
		<input type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d'})" id="datemax" class="input-text Wdate" style="width:120px;">
		<button type="submit" class="btn btn-success" id="searchUsers" name=""><i class="Hui-iconfont">&#xe665;</i> 查询</button>
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="r">共有数据：<strong id="pageTotal">54</strong> 条</span> </div>
	<table id="userListTable" class="table table-border table-bordered table-bg table-hover">
		<thead>
			<tr>
				<th scope="col" colspan="10">租车历史</th>
			</tr>
			<tr class="text-c">
				<th >订单号</th>
				<th >车牌号码</th>
				<th >租车人</th>
				<th >租车人手机</th>
				<th >租车时间</th>
				<th >还车时间</th>
				<th >违章</th>
				<th >车损</th>
				<th >出险</th>
				<th >取车地</th>
				<th >还车地</th>
				<th >操作</th>
			</tr>
		</thead>
	</table>
</div>

<#include "include/_footer.html">

<script type="text/javascript">

$(function(){

    initTable();
  
});


var initTable = function(){

$('#userListTable').dataTable( {
    	"processing": false,
      	"serverSide": true,
      	"bSort": false,
      	"bFilter":false,
      	"bLengthChange":false,
      	"iDisplayLength":10,
      	"bRetrieve":true,
      	"ajax": {
            "url": "/ordershistory",
           	"data":function(d){
		        d.carid = $('#carid').val();
		        d.datemin = $('#datemin').val();
		        d.datemax = $('#datemax').val();
		    },
            "type": "get"
        },
        "columns": [
            { "data": "orderid" },
            { "data": "carid" },
            { "data": "name" },
            { "data": "mobile" },
            { "data": "realbttime" },
            { "data": "realettime" },
            { "data": "returnillegal" },
            { "data": "returndamage" },
            { "data": "realbasic" },
            { "data": "btrentdept" },
            { "data": "etrentdept" },
            { "data": "" }
      	],
      	"columnDefs": [
	        {
		          "targets": [11],
		          "data": "orderid",
		          "render": function(data, type, full) {
		          
		          			var action_check ="<a title=\"查看\" href=\"javascript:;\" onclick=\"admin_edittwo('租用历史','/ historyquery?orderid="+full.orderid+"','2','1200','600')\" class=\"ml-5\" style=\"text-decoration:none\">详细信息</a>";
		          
		            		return action_check;
		          }
	        }	        
      	],
      	"fnRowCallback" : function(nRow, aData, iDisplayIndex) { 
      					                   
                        return nRow;  
         },
	    "fnDrawCallback": function(oSettings) {
		      //获取后台方式 直接可以拿到json 之后进行处理
		      var json=jQuery.parseJSON(oSettings.jqXHR.responseText);  
		      $("#pageTotal").html(json.recordsTotal);
	    }
  
      	
    });

}


$("#searchUsers").click(function() {
    	var i_data = $('#carid').val();
    	console.log("datemin:"+ $('#datemin').val());
    	console.log("datemax:"+ $('#datemax').val());

        $("#userListTable").dataTable().fnClearTable();
        initTable();
});


/*
	参数解释：
	title	标题
	url		请求的url
	id		需要操作的数据id
	w		弹出层宽度（缺省调默认值）
	h		弹出层高度（缺省调默认值）
*/


/*管理员-编辑*/
function admin_edittwo(title,url,id,w,h){
	layer_show(title,url,w,h);
}

</script>
</body>
</html>